<?php
/**
 * @file promotionstat.php $
 * @author LinLin (linlin@haibao.com) $
 * @date 2015-9-9 下午1:54:25 $
 * @brief  $
 */
namespace haibao\app\data;

class PromotionStat extends \haibao\app\data\BaseMysql{

	public function __construct(){
		parent::__construct('\haibao\app\model\data\PromotionStat');
	}

	public function getAllCount(){
		$sql = "select a.ProId ,b.ProName,sum(a.TotalCount) as TotalCount from PromotionStat as a left join Promotion as b on a.ProId=b.Id group by a.ProId";
		$result = $this->query($sql);
		$list = array();
		$countList = array();
		while($result->fetch_assoc()){
			$list['ProId'] = $result->getData('ProId');
			$list['ProName'] = $result->getData('ProName');
			$list['TotalCount'] = $result->getData('TotalCount');
			$countList[] = $list;
		}
		return $countList;
	}
}
